namespace Scap.Data.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class db1 : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.ScapEmployeeAssistances", "EmployeeId", "dbo.ScapDepartmentEmployees");
            DropIndex("dbo.ScapEmployeeAssistances", new[] { "EmployeeId" });
            CreateTable(
                "dbo.ScapDepartmentEmployeeAssistances",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        CheckTime = c.DateTime(nullable: false),
                        Type = c.Int(nullable: false),
                        WorkCode = c.Int(nullable: false),
                        Employee_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.ScapDepartmentEmployees", t => t.Employee_Id)
                .Index(t => t.Employee_Id);
            
            DropTable("dbo.ScapEmployeeAssistances");
        }
        
        public override void Down()
        {
            CreateTable(
                "dbo.ScapEmployeeAssistances",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        EmployeeId = c.Int(nullable: false),
                        CheckTime = c.DateTime(nullable: false),
                        Type = c.Int(nullable: false),
                        RawData = c.String(),
                        Comments = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
            DropIndex("dbo.ScapDepartmentEmployeeAssistances", new[] { "Employee_Id" });
            DropForeignKey("dbo.ScapDepartmentEmployeeAssistances", "Employee_Id", "dbo.ScapDepartmentEmployees");
            DropTable("dbo.ScapDepartmentEmployeeAssistances");
            CreateIndex("dbo.ScapEmployeeAssistances", "EmployeeId");
            AddForeignKey("dbo.ScapEmployeeAssistances", "EmployeeId", "dbo.ScapDepartmentEmployees", "Id", cascadeDelete: true);
        }
    }
}
